
PieceKing.prototype = new Piece();

function PieceKing(io_obj, color_str){
	/** HERITAGE */
	this.parent = Piece;
	this.parent (io_obj, color_str);
	
	/** PRIVATE */
	
	/** PUBLIC */
	this._constructor = function pieceKing__constructor (io_obj, color_str) {
		this._type = "king";
	}

	this.canMoveTo = function pieceKing_canMoveTo (loc_obj) {
		var old_loc_obj, result;
		old_loc_obj = this.getLocation ();

		this._io.print("PieceKing.canMoveTo -- ");
		var move_obj = new MoveLinear (
				this.getIO (), 
				this, 
				old_loc_obj, 
				loc_obj
				);
		move_obj.setMaxDistance (1);
		result = false; // by default

		if ((move_obj.isVertical() 
					|| move_obj.isHorizontal() 
					|| move_obj.isDiagonal()) 
				&& move_obj.isPossible())
		{
			result = true;
		}

		return result;
	}

	/** CONSTRUCT ! */
	this._constructor (io_obj, color_str);
}
